<template>
  <div class="box">
    <img :src="dogImgUrl" alt="" />
    <p @click="btn" :style="{ backgroundColor: bool }">{{ dogName }}</p>
  </div>
</template>

<script>
export default {
  props: ['dogImgUrl', 'dogName'],
  data(){
    return{
        bool:''
    }
  },
  methods: {
    btn() {
      this.R = Math.floor(Math.random() * 256)
      this.G = Math.floor(Math.random() * 256)
      this.B = Math.floor(Math.random() * 256)
      this.bool = `rgb(${this.R},${this.G},${this.B})`
    },
  },
}
</script>

<style>
.box {
  float: left;
  width: 300px;
  border: 1px solid black;
  text-align: center;
}
img {
  width: 100%;
  height: 200px;
}
</style>
